package com.dabaozhan.modules.wx_app.service.impl;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.SiteCategoryMapper;
import com.dabaozhan.modules.wx_app.entity.SiteCategoryEntity;
import com.dabaozhan.modules.wx_app.service.SiteCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author houzhong
 * @date 2019-01-09 16:29
 */

@Service("siteCategoryService")
public class SiteCategoryServiceImpl implements SiteCategoryService {

    @Autowired
    private SiteCategoryMapper siteCategoryMapper;

    @Override
    public int saveSiteCategoey(SiteCategoryEntity v) {
        if (v.getId() == null) {
            v.setId(Utils.id().toString());
        }
        return siteCategoryMapper.save(v);
    }

    @Override
    public int updateSiteCategoey(SiteCategoryEntity v) {
        return siteCategoryMapper.update(v);
    }

    @Override
    public int deleteSiteCategory(String id) {
        return siteCategoryMapper.remove(id);
    }

    @Override
    public SiteCategoryEntity getSiteCategoryId(String id) {

        return siteCategoryMapper.getObjectById(id);
    }

    @Override
    public List<SiteCategoryEntity> findBySiteCategoryList(SiteCategoryEntity v) {
        return siteCategoryMapper.findBySiteCategoryList(v);
    }
}
